<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var test = /^\w{5,12}$/
        if (test.test('qwee')) {
            alert('yes')
        } else {
            alert('no')
        }
    </script>
</head>
<body>

</body>
</html>